package org.jin.samples.test;


import org.jin.samples.model.vo.ExamSubjectVO;
import org.jin.samples.service.ISubjectService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"file:WebContent/WEB-INF/viewspace-servlet.xml"})
public class Subject {
     
	@Autowired
	private ISubjectService subjectService;
	
	@Test
	public void findbyid(){
		ExamSubjectVO vo = subjectService.findSubjectById(1);
		System.out.println(vo.getName());
	}
	
	@Test
	public void create(){
		ExamSubjectVO vo = new ExamSubjectVO();
		vo.setName("英语");
		vo.setDescription("必修");
		vo.setTestCount(30);
		vo.setTotalTime(120);
		vo.setTotalScore(100);
		vo.setStatus(1);
		subjectService.addSubject(vo);
	}
	
	@Test
	public void updata(){
		ExamSubjectVO vo = new ExamSubjectVO();
		vo.setSubId(4);
		vo.setName("英语");
		vo.setDescription("必修");
		vo.setTestCount(30);
		vo.setTotalTime(150);
		vo.setTotalScore(120);
		vo.setStatus(1);
		subjectService.Updata(vo);
		
	}
	
	@Test
	public void updata1(){	
		ExamSubjectVO vo = new ExamSubjectVO();
		vo.setSubId(3);
		vo.setStatus(1);
		subjectService.UpdataStatus(vo);
		
	}
	
	@Test
	public void test1(){
		ExamSubjectVO esVO = subjectService.findSubjectById(1);
		System.out.println("esVO.getSubId()="+esVO.getSubId());
		System.out.println("esVO.getTotalTime()="+esVO.getTotalTime());
		System.out.println("esVO.getTotalScore()"+esVO.getTotalScore());
	}
	
	
}
